import request from '@/utils/request'

// 数据中心相关接口
export function getDataCenterList() {
  return request({
    url: '/datacenter/list',
    method: 'get'
  })
}

export function createDataCenter(data) {
  return request({
    url: '/datacenter',
    method: 'post',
    data
  })
}

export function updateDataCenter(data) {
  return request({
    url: '/datacenter',
    method: 'put',
    data
  })
}

export function deleteDataCenter(id) {
  return request({
    url: `/datacenter/${id}`,
    method: 'delete'
  })
}

// 数据库实例相关接口
export function getInstanceList() {
  return request({
    url: '/instance/list',
    method: 'get'
  })
}

export function createInstance(data) {
  return request({
    url: '/instance',
    method: 'post',
    data
  })
}

export function updateInstance(data) {
  return request({
    url: '/instance',
    method: 'put',
    data
  })
}

export function deleteInstance(id) {
  return request({
    url: `/instance/${id}`,
    method: 'delete'
  })
}

export function bindTemplate(data) {
  return request({
    url: '/instance/bind-template',
    method: 'post',
    data
  })
}

// 配置模板相关接口
export function getTemplateList() {
  return request({
    url: '/template/list',
    method: 'get'
  })
}

export function createTemplate(data) {
  return request({
    url: '/template',
    method: 'post',
    data
  })
}

export function updateTemplate(data) {
  return request({
    url: '/template',
    method: 'put',
    data
  })
}

export function deleteTemplate(id) {
  return request({
    url: `/template/${id}`,
    method: 'delete'
  })
} 